package com.zhuiyun.educations.api.voide.mapper;


import com.zhuiyun.educations.api.voide.entity.Voide;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;

/**
 * @Description:
 * @ClassName: VoideMapper
 * @Author: YB
 * @Date: 2023/6/23 11:49
 * @Version: 1.0
 */
@Mapper
public interface VoideMapper  {

    /**
        * @Author yuanb
        * @Description 把分片信息保存到数据库
        * @Date 2023/7/5 15:21
        * @Return com.zhuiyun.educations.api.voide.entity.Voide
        * @param chunkDTO
    */
    @Insert("INSERT INTO fragmentation (identifier, chunk_number, chunk_size, total_size, total_chunks, filename, create_time) " +
            "VALUES (#{identifier}, #{chunkNumber}, #{chunkSize}, #{totalSize}, #{totalChunks}, #{filename}, #{createTime})")
//    @Options(useGeneratedKeys = true, keyProperty = "id")
    void saveToDatabase(Voide chunkDTO);

    /**
        * @Author yuanb
        * @Description 把合并后的文件信息保存到数据库
        * @Date 2023/7/5 16:38
        * @Return void
        * * @param voide
    */
    @Insert("insert into file_merge(filename, file_path,total_size,del_flag,file_type,create_time) " +
            "values (#{filename}, #{filePath},#{totalSize},#{delFlag},#{fileType},#{createTime})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    Integer saveToDatabase1(Voide voide);

}
